using System.Data.Entity;
using yiCommerce.Core.Domain;
using yiCommerce.Data.Mapping;
using yiCommerce.Data.Mapping.Addresses;
using yiCommerce.Data.Mapping.Brands;
using yiCommerce.Data.Mapping.Categorys;
using yiCommerce.Data.Mapping.Customers;
using yiCommerce.Data.Mapping.FriendShips;
using yiCommerce.Data.Mapping.Messages;
using yiCommerce.Data.Mapping.Orders;
using yiCommerce.Data.Mapping.Payments;
using yiCommerce.Data.Mapping.PrivateMessages;
using yiCommerce.Data.Mapping.Products;
using yiCommerce.Data.Mapping.Securitys;
using yiCommerce.Data.Mapping.Shippings;
using yiCommerce.Data.Mapping.ShoppingCarts;
using yiCommerce.Data.Mapping.Shops;
using yiCommerce.Data.Mapping.Statuses;
using yiCommerce.Data.Mapping.Tags;
using yiCommerce.Data.Mapping.Tradings;


namespace yiCommerce.Data
{
    public class YiObjectContext : DbContext
    {
        static YiObjectContext()
        {
            Database.SetInitializer<YiObjectContext>(null);

            
        }

        public YiObjectContext()
            : base("name=YiContext")
        {
           // this.Configuration.ProxyCreationEnabled = false;
        }

        public YiObjectContext(string connStr)
            : base(connStr)
        {
        }


        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new AddressMapping());

            modelBuilder.Configurations.Add(new BrandMapping());
            modelBuilder.Configurations.Add(new ProductBrandMapping());

            modelBuilder.Configurations.Add(new CategoryMapping());
            modelBuilder.Configurations.Add(new ProductCategoryMapping());

            modelBuilder.Configurations.Add(new CustomerMapping());
            modelBuilder.Configurations.Add(new CustomerRoleMapping());

            modelBuilder.Configurations.Add(new OrderMapping());
            modelBuilder.Configurations.Add(new OrderProductVariantMappping());

            modelBuilder.Configurations.Add(new ProductAttributeMapping());
            modelBuilder.Configurations.Add(new ProductMapping());
            modelBuilder.Configurations.Add(new ProductPictureMapping());
            modelBuilder.Configurations.Add(new ProductSpecificationAttributeMapping());
            modelBuilder.Configurations.Add(new ProductVariantAttributeMapping());
            modelBuilder.Configurations.Add(new ProductVariantAttributeValueMapping());
            modelBuilder.Configurations.Add(new ProductVariantMapping());
            modelBuilder.Configurations.Add(new SpecificationAttributeMapping());
            modelBuilder.Configurations.Add(new SpecificationAttributeOptionMapping());

            modelBuilder.Configurations.Add(new PermissionRecordMapping());
            modelBuilder.Configurations.Add(new ShoppingCartItemMapping());

            modelBuilder.Configurations.Add(new ShopMapping());
            modelBuilder.Configurations.Add(new TradingMapping());

            modelBuilder.Configurations.Add(new AlipayPaymethodSettingMapping());
            modelBuilder.Configurations.Add(new TradingIdMap());
            modelBuilder.Configurations.Add(new SystemSettingMapping());
            modelBuilder.Configurations.Add(new ShipmentMapping());
            modelBuilder.Configurations.Add(new FriendShipMapping());
            modelBuilder.Configurations.Add(new StatusesMapping());
            modelBuilder.Configurations.Add(new CustomerLogoMapping());
            modelBuilder.Configurations.Add(new FriendShipGroupMapping());
            modelBuilder.Configurations.Add(new PrivateMessageMapping());
            //modelBuilder.Configurations.Add(new MessageMapping());
            modelBuilder.Configurations.Add(new CommentMapping());
            modelBuilder.Configurations.Add(new TagMapping());
            modelBuilder.Configurations.Add(new StatusTagMapping());
            modelBuilder.Configurations.Add(new StatusPointDetailMapping());

            

         
            
        }
    }
}
